# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=unibilium
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.1
pkgrel=3
pkgdesc="A terminfo parsing library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
url='https://github.com/neovim/unibilium'
makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-autotools")
license=('spdx:LGPL-3.0-or-later')
source=("${_realname}-${pkgver}.tar.gz::https://github.com/neovim/unibilium/archive/v${pkgver}.tar.gz"
        "0001-unibilium-msys-makefile.patch"
        "0002-unibilium-make-add-no-undefined.patch")
sha256sums=('6f0ee21c8605340cfbb458cbd195b4d074e6d16dd0c0e12f2627ca773f3cabf1'
            '62d9b9e6650e4abc44afdb800469ca2332b70abbcacfd6e554f0a0ce7f4d3351'
            'b5bac9472b0c5c54f1693c073fe261701d9e3c712b17bf302ac6ef3a5ab98555')

prepare() {
  cd "${_realname}-${pkgver}"
  patch -Np1 -i "${srcdir}/0001-unibilium-msys-makefile.patch"
  patch -Np1 -i "${srcdir}/0002-unibilium-make-add-no-undefined.patch"
}

build() {
  cd ${_realname}-${pkgver}
  make PREFIX=${MINGW_PREFIX}
}

check() {
  cd ${_realname}-${pkgver}
  make test
}

package() {
  cd ${_realname}-${pkgver}
  make install PREFIX=${MINGW_PREFIX} DESTDIR="${pkgdir}"
}
